home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / C / LIB / DESK / CORE / Desk / h_doc / Wimp < prev    next >
Text File  |  1996-05-21  |  29KB  |  1,167 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Wimp.h
  12.     Author:  Copyright © 1992, 1993, 1994 John Winters and Jason Williams
  13.     Version: 1.12 (26 Jun 1994)
  14.     Purpose: Type/structure definitions for Wimp SWI interface
  15. */
  16.  
  17.  
  18. #ifndef __Desk_Wimp_h
  19. #define __Desk_Wimp_h
  20.  
  21. #ifdef __cplusplus
  22.     extern "C" {
  23. #endif
  24.  
  25.  
  26. #ifndef __Desk_Core_h
  27.     #include "Desk.Core.h"
  28. #endif
  29.  
  30.  
  31.  
  32. #define Desk_wimp_MAXNAME 12
  33. /* The size of wimp names (icon text fields, sprite names, etc) */
  34.  
  35.  
  36. typedef struct
  37. {
  38.   int x, y;
  39. } Desk_wimp_point;
  40. /*
  41. A C struct which corresponds with how the RISC OS Window Manager usually
  42. represents (x, y) points.
  43. */
  44.  
  45. typedef Desk_wimp_point Desk_wimp_coord;
  46.  
  47.  
  48. typedef struct
  49. {
  50.   Desk_wimp_point min;
  51.   Desk_wimp_point max;
  52. } Desk_wimp_rect;
  53. /*
  54. A C struct which corresponds with how the RISC OS Window Manager usually
  55. represents rectangles.
  56. */
  57.  
  58.  
  59. typedef Desk_wimp_rect Desk_wimp_box;
  60.  
  61. typedef int Desk_window_handle;
  62. typedef int Desk_icon_handle;
  63. typedef int Desk_task_handle;
  64.  
  65.  
  66. /* -------------------------------------------------------------------------
  67.    Wimp colours and palettes
  68.    ------------------------------------------------------------------------- */
  69.  
  70. #define Desk_colour_WHITE        0
  71. #define Desk_colour_GREY0        0
  72. #define Desk_colour_GREY1        1
  73. #define Desk_colour_GREY2        2
  74. #define Desk_colour_GREY3        3
  75. #define Desk_colour_GREY4        4
  76. #define Desk_colour_GREY5        5
  77. #define Desk_colour_GREY6        6
  78. #define Desk_colour_GREY7        7
  79. #define Desk_colour_BLACK        7
  80. #define Desk_colour_DARK_BLUE    8
  81. #define Desk_colour_YELLOW       9
  82. #define Desk_colour_GREEN       10
  83. #define Desk_colour_RED         11
  84. #define Desk_colour_CREAM       12
  85. #define Desk_colour_ARMY_GREEN  13
  86. #define Desk_colour_ORANGE      14
  87. #define Desk_colour_LIGHT_BLUE  15
  88.  
  89. #define Desk_colour_TRANSPARENT 255 
  90.  
  91. typedef union
  92. {
  93.   int value;
  94.   struct
  95.   {
  96.     unsigned int wimpcolour : 4;
  97.     unsigned int gcolaction : 3;
  98.     unsigned int foreback   : 1;
  99.     unsigned int padding    : 24;
  100.   } data;
  101. } Desk_wimp_colour;
  102.  
  103.  
  104. typedef union
  105. {
  106.   int value;
  107.   struct
  108.   {
  109.     char gcol;
  110.     char red;
  111.     char green;
  112.     char blue;
  113.   } data;
  114. } Desk_palette_entry;
  115. /*
  116. This holds a RGB colour in the correct form for the ColourTrans SWIs
  117. */
  118.  
  119. typedef struct
  120. {
  121.   Desk_palette_entry colour[16];
  122.   Desk_palette_entry border;
  123.   Desk_palette_entry mouse1;
  124.   Desk_palette_entry mouse2;
  125.   Desk_palette_entry mouse3;
  126. } Desk_palette_block;
  127.                 
  128.  
  129. /* -------------------------------------------------------------------------
  130.    Wimp icon data:
  131.    ------------------------------------------------------------------------- */
  132.  
  133. #define Desk_iconbtype_NEVER            0
  134. #define Desk_iconbtype_ALWAYS           1
  135. #define Desk_iconbtype_AUTOREPEAT       2
  136. #define Desk_iconbtype_CLICK            3
  137. #define Desk_iconbtype_RELEASE          4
  138. #define Desk_iconbtype_DOUBLECLICK      5
  139. #define Desk_iconbtype_CLICKDRAG        6
  140. #define Desk_iconbtype_RELEASEDRAG      7
  141. #define Desk_iconbtype_DOUBLEDRAG       8
  142. #define Desk_iconbtype_MENU             9
  143. #define Desk_iconbtype_DOUBLECLICKDRAG 10
  144. #define Desk_iconbtype_RADIO           11
  145. #define Desk_iconbtype_RESERVED1       12
  146. #define Desk_iconbtype_RESERVED2       13
  147. #define Desk_iconbtype_WRITECLICKDRAG  14
  148. #define Desk_iconbtype_WRITABLE        15
  149.  
  150.  
  151. /*  Icon bar icon positions, and
  152.  *  the window handle of the iconbar when returned by the Wimp
  153.  */
  154. #define Desk_iconbar_RIGHT -1
  155. #define Desk_iconbar_LEFT  -2
  156. #define Desk_window_ICONBAR -2
  157.  
  158. /* Icon flag bits */
  159. #define Desk_icon_TEXT        0x00000001      /* icon contains text               */
  160. #define Desk_icon_SPRITE      0x00000002      /* icon is a sprite                 */
  161. #define Desk_icon_BORDER      0x00000004      /* icon has a border                */
  162. #define Desk_icon_HCENTRE     0x00000008      /* text is horizontally centred     */
  163. #define Desk_icon_VCENTRE     0x00000010      /* text is vertically centred       */
  164. #define Desk_icon_FILLED      0x00000020      /* icon has a filled background     */
  165. #define Desk_icon_FONT        0x00000040      /* text is an anti-aliased font     */
  166. #define Desk_icon_NEEDSHELP   0x00000080      /* redraw needs application's help  */
  167. #define Desk_icon_INDIRECTED  0x00000100      /* icon data is 'indirected'        */
  168. #define Desk_icon_RJUSTIFY    0x00000200      /* text right justified in box      */
  169. #define Desk_icon_ALLOWADJUST 0x00000400      /* Allow multiple select with adjust*/
  170. #define Desk_icon_HALVESPRITE 0x00000800      /* plot sprites half-size           */
  171. #define Desk_icon_BUTTONTYPE  0x00001000      /* 4-bit field: button type         */
  172. #define Desk_icon_SELECTED    0x00200000      /* icon selected by user (inverted) */
  173. #define Desk_icon_SHADED      0x00400000      /* icon cannot be selected (shaded) */
  174. #define Desk_icon_DELETED     0x00800000      /* icon has been deleted            */
  175.  
  176. #define Desk_icon_FORECOLOUR  0x01000000      /* 4-bit field: foreground colour   */
  177. #define Desk_icon_BACKCOLOUR  0x10000000      /* 4-bit field: background colour   */
  178.  
  179. #define Desk_iconvalid_ALLOW           'A'
  180. #define Desk_iconvalid_BORDERTYPE      'R'
  181. #define Desk_iconvalid_DISPLAY         'D'
  182. #define Desk_iconvalid_FONTCOLOURS     'F'
  183. #define Desk_iconvalid_LINESPACE       'L'
  184. #define Desk_iconvalid_SPRITENAME      'S'
  185.  
  186. #define Desk_iconborder_PLINTH          0
  187. #define Desk_iconborder_SURROUND        1
  188. #define Desk_iconborder_OKBUTTON        2
  189. #define Desk_iconborder_INDENT          3
  190.  
  191. typedef union
  192. {
  193.   unsigned int value;
  194.  
  195.   struct
  196.   {
  197.     unsigned int garbage1      : 6;    /* New struct to allow easy access to */
  198.     unsigned int font          : 1;    /* the font handle of an icon. NOTE   */
  199.     unsigned int garbage2      : 17;   /* that handle is ONLY valid IF       */
  200.     unsigned int handle        : 8;    /* 'font' is Desk_bool_TRUE.                    */
  201.   } font;
  202.  
  203.   struct
  204.   {
  205.     unsigned int text          : 1;
  206.     unsigned int sprite        : 1;
  207.     unsigned int border        : 1;
  208.     unsigned int hcentre       : 1;
  209.     unsigned int vcentre       : 1;
  210.     unsigned int filled        : 1;
  211.     unsigned int font          : 1;
  212.     unsigned int needshelp     : 1;
  213.     unsigned int indirected    : 1;
  214.     unsigned int rightjustify  : 1;
  215.     unsigned int allowadjust   : 1;
  216.     unsigned int halfsize      : 1;
  217.     unsigned int buttontype    : 4;
  218.     unsigned int esg           : 5;
  219.     unsigned int selected      : 1;
  220.     unsigned int shaded        : 1;
  221.     unsigned int deleted       : 1;
  222.     unsigned int foreground    : 4;
  223.     unsigned int background    : 4;
  224.   } data;
  225. } Desk_icon_flags;
  226. /*
  227. Used in Desk_icon_block
  228. */
  229.  
  230. typedef struct
  231. {
  232.   char         *buffer;
  233.   char         *validstring;
  234.   unsigned int bufflen;
  235. } Desk_icon_indtext;
  236. /*
  237. Used in Desk_icon_data union
  238. */
  239.  
  240.  
  241. typedef struct
  242. {
  243.   const char   *name;
  244.   void         *spritearea;
  245.   unsigned int nameisname;
  246. } Desk_icon_indsprite;
  247. /*
  248. Used in Desk_icon_data union
  249. */
  250.  
  251. typedef union
  252. {
  253.   char           text[Desk_wimp_MAXNAME];
  254.   Desk_icon_indtext   indirecttext;
  255.   char           spritename[Desk_wimp_MAXNAME];
  256.   Desk_icon_indsprite indirectsprite;
  257. } Desk_icon_data;
  258. /*
  259. Used in Desk_icon_block
  260. */
  261.  
  262.  
  263. typedef struct
  264. {
  265.   Desk_wimp_box   workarearect;
  266.   Desk_icon_flags flags;
  267.   Desk_icon_data  data;
  268. } Desk_icon_block;
  269. /*
  270. See Desk_Wimp_GetIconState, Desk_Wimp_PlotIcon
  271. */
  272.  
  273. typedef struct
  274. {
  275.   Desk_window_handle window;
  276.   Desk_icon_block    icondata;
  277. } Desk_icon_createblock;
  278. /*
  279. Use with Desk_Wimp_CreateIcon
  280. */
  281.  
  282.  
  283. /* -------------------------------------------------------------------------
  284.    Window data:
  285.    ------------------------------------------------------------------------- */
  286.  
  287. typedef union
  288. {
  289.   struct
  290.   {
  291.     unsigned int hastitle          : 1;  /* This is an "old-style" flag - don't use it */
  292.     unsigned int moveable          : 1;
  293.     unsigned int hasvscroll        : 1;  /* This is an "old-style" flag - don't use it */
  294.     unsigned int hashscroll        : 1;  /* This is an "old-style" flag - don't use it */
  295.     unsigned int autoredraw        : 1;
  296.     unsigned int pane              : 1;
  297.     unsigned int nobounds          : 1;
  298.     unsigned int nobackclose       : 1;  /* This is an "old-style" flag - don't use it */
  299.     unsigned int scrollrq          : 1;
  300.     unsigned int scrollrqdebounced : 1;
  301.     unsigned int realcolours       : 1;
  302.     unsigned int backwindow        : 1;
  303.     unsigned int hotkeys           : 1;
  304.     unsigned int keeponscreen      : 1;
  305.     unsigned int ignoreright       : 1;
  306.     unsigned int ignorebottom      : 1;
  307.     unsigned int open              : 1;
  308.     unsigned int top               : 1;
  309.     unsigned int fullsize          : 1;
  310.     unsigned int istoggling        : 1;
  311.     unsigned int focus             : 1;
  312.     unsigned int forceonce         : 1;
  313.     unsigned int dummy22           : 1;
  314.     unsigned int dummy23           : 1;
  315.     unsigned int backicon          : 1;
  316.     unsigned int closeicon         : 1;
  317.     unsigned int titlebar          : 1;
  318.     unsigned int toggleicon        : 1;
  319.     unsigned int vscroll           : 1;
  320.     unsigned int adjusticon        : 1;
  321.     unsigned int hscroll           : 1;
  322.     unsigned int newflags          : 1;  /* This should always be Desk_bool_TRUE */
  323.   } data;
  324.   int value;
  325. } Desk_window_flags;
  326. /*
  327. Used in Desk_window_block
  328. */
  329.  
  330. typedef struct                /* Minimum width/height of window. Used to be: */
  331. {                             /*   unsigned short minwidth, minheight;       */
  332.   int x : 16;                 /* This has been changed for compatability     */
  333.   int y : 16;                 /* with compilers other than Desktop C         */
  334. } Desk_window_minsize;
  335. /*
  336. Used in Desk_window_block
  337. */
  338.  
  339. typedef enum
  340. {
  341.   Desk_windowcol_TITLEFORE = 0,
  342.   Desk_windowcol_TITLEBACK,
  343.   Desk_windowcol_WORKFORE,
  344.   Desk_windowcol_WORKBACK,
  345.   Desk_windowcol_SCROLLBACK,
  346.   Desk_windowcol_SCROLLFORE,
  347.   Desk_windowcol_TITLEHILITE
  348. } Desk_window_colourindices;
  349.  
  350.  
  351. typedef struct
  352. {
  353.   Desk_wimp_box       screenrect;
  354.   Desk_wimp_point     scroll;
  355.   Desk_window_handle  behind;
  356.   Desk_window_flags   flags;
  357.   char           colours[8];
  358.   Desk_wimp_box       workarearect;
  359.   Desk_icon_flags     titleflags;
  360.   Desk_icon_flags     workflags;
  361.   void           *spritearea;
  362.   Desk_window_minsize minsize;
  363.   Desk_icon_data      title;
  364.   unsigned int   numicons;
  365.   /*
  366.    *  What we really want here is :
  367.   Desk_icon_block        icons [0];
  368.    *  but unfortunately 'C' (stupidly) doesn't allow it.  Just think it.
  369.    */
  370. } Desk_window_block;
  371. /*
  372. This is used by Desk_Wimp_CreateWindow
  373. */
  374.  
  375. typedef struct
  376. {
  377.   Desk_window_handle window;
  378.   Desk_wimp_box      screenrect;
  379.   Desk_wimp_point    scroll;
  380.   Desk_window_handle behind;
  381. } Desk_window_openblock;
  382. /*
  383. This is used with Desk_Wimp_OpenWindow
  384. */
  385.  
  386. typedef struct
  387. {
  388.   Desk_window_openblock openblock;
  389.   Desk_window_flags     flags;
  390. } Desk_window_state;
  391. /*
  392. Used with Desk_Wimp_GetWindowState
  393. */
  394.  
  395. typedef struct
  396. {
  397.   Desk_window_handle window;
  398.   Desk_window_block  block;
  399. } Desk_window_info;
  400. /*
  401. Used with Desk_Wimp_GetWindowInfo
  402. */
  403.  
  404. typedef struct
  405. {
  406.   Desk_window_handle window;
  407.   Desk_wimp_box      rect;
  408.   Desk_wimp_point    scroll;
  409.   Desk_wimp_box      cliprect;
  410. } Desk_window_redrawblock;
  411. /*
  412. Used with Desk_Wimp_ForceRedraw, Desk_Wimp_UpdateWindow
  413. */
  414.  
  415. typedef struct
  416. {
  417.   Desk_window_handle window;
  418.   Desk_wimp_box      screenrect;
  419. } Desk_window_outline;
  420. /*
  421. Used with Desk_Wimp_GetWindowOutline
  422. */
  423.  
  424.  
  425. /* -------------------------------------------------------------------------
  426.    Mouse/Pointer information:
  427.    ------------------------------------------------------------------------- */
  428.  
  429. #define Desk_button_ADJUST      0x00000001
  430. #define Desk_button_MENU        0x00000002
  431. #define Desk_button_SELECT      0x00000004
  432. #define Desk_button_DRAGADJUST  0x00000010
  433. #define Desk_button_DRAGSELECT  0x00000040
  434. #define Desk_button_CLICKADJUST 0x00000100
  435. #define Desk_button_CLICKSELECT 0x00000400
  436.  
  437. #define Desk_button2_CLICKADJUST 0x00000001 /* For buttontype 10 (PRMs 3-100) */
  438. #define Desk_button2_CLICKSELECT 0x00000004 /* For buttontype 10 (PRMs 3-100) */
  439. #define Desk_button2_DRAGADJUST  0x00000010 /* For buttontype 10 (PRMs 3-100) */
  440. #define Desk_button2_DRAGSELECT  0x00000040 /* For buttontype 10 (PRMs 3-100) */
  441. #define Desk_button2_ADJUST      0x00000100 /* For buttontype 10 (PRMs 3-100) */
  442. #define Desk_button2_MENU        0x00000200 /* For buttontype 10 (PRMs 3-100) */
  443. #define Desk_button2_SELECT      0x00000400 /* For buttontype 10 (PRMs 3-100) */
  444.  
  445. typedef union
  446. {
  447.   unsigned int value;
  448.   
  449.   struct
  450.   {
  451.     unsigned int adjust       : 1;
  452.     unsigned int menu         : 1;
  453.     unsigned int select       : 1;
  454.     unsigned int dummy3       : 1;
  455.     unsigned int dragadjust   : 1;
  456.     unsigned int dummy5       : 1;
  457.     unsigned int dragselect   : 1;
  458.     unsigned int dummy7       : 1;
  459.     unsigned int clickadjust  : 1;
  460.     unsigned int dummy9       : 1;
  461.     unsigned int clickselect  : 1;
  462.   } data;
  463.   
  464.   struct
  465.   {
  466.     unsigned int clickadjust  : 1;
  467.     unsigned int dummy1       : 1;
  468.     unsigned int clickselect  : 1;
  469.     unsigned int dummy3       : 1;
  470.     unsigned int dragadjust   : 1;
  471.     unsigned int dummy5       : 1;
  472.     unsigned int dragselect   : 1;
  473.     unsigned int dummy7       : 1;
  474.     unsigned int adjust       : 1;
  475.     unsigned int menu         : 1;
  476.     unsigned int select       : 1;
  477.   }
  478.   data2; /* For use with button-type 10 */
  479.  
  480. } Desk_button_state;
  481. /*
  482. Used in Desk_mouse_block
  483. */
  484.  
  485. typedef struct
  486. {
  487.   Desk_wimp_point    pos;
  488.   Desk_button_state  button;
  489.   Desk_window_handle window;
  490.   Desk_icon_handle   icon;
  491. } Desk_mouse_block;
  492. /* 
  493. Used in Desk_Wimp_GetPointerInfo
  494. Also a field in the Desk_event_data union.
  495. */
  496.  
  497. typedef struct
  498. {
  499.   int           shapenumber;
  500.   char          *shapedata;
  501.   unsigned int  width;
  502.   unsigned int  height;
  503.   Desk_wimp_point    active;
  504. } Desk_pointer_shapeblock;
  505.  
  506.  
  507. /* -------------------------------------------------------------------------
  508.    Wimp drag data:
  509.    ------------------------------------------------------------------------- */
  510.  
  511. typedef enum
  512. {
  513.   Desk_drag_MOVEWINDOW    = 1,
  514.   Desk_drag_RESIZEWINDOW,
  515.   Desk_drag_SCROLLX,
  516.   Desk_drag_SCROLLY,
  517.   Desk_drag_FIXEDBOX,
  518.   Desk_drag_RUBBERBOX,
  519.   Desk_drag_INVISIBLE,
  520.   Desk_drag_USERFIXEDBBOX,
  521.   Desk_drag_USERRUBBERBOX,
  522.   Desk_drag_USERFIXEDNC,
  523.   Desk_drag_USERRUBBERNC
  524. } Desk_drag_type;
  525. /*
  526. This a field in Desk_drag_block
  527. */
  528.  
  529. typedef struct
  530. {
  531.   Desk_window_handle window;
  532.   Desk_drag_type     type;
  533.   Desk_wimp_box      screenrect;
  534.   Desk_wimp_box      parent;
  535. } Desk_drag_block;
  536. /*
  537. Used in Desk_Wimp_DragBox
  538. */
  539.  
  540. /* -------------------------------------------------------------------------
  541.    Wimp errors:
  542.    ------------------------------------------------------------------------- */
  543.  
  544. typedef union
  545. {
  546.   unsigned int value;
  547.   struct
  548.   {
  549.     unsigned int ok               : 1;
  550.     unsigned int cancel           : 1;
  551.     unsigned int highlightcancel  : 1;
  552.     unsigned int noprompt         : 1;
  553.     unsigned int noprefix         : 1;
  554.     unsigned int nowait           : 1;
  555.     unsigned int closebox         : 1;
  556.   } data;
  557. } Desk_error_flags;
  558. /*
  559. See Desk_Wimp_ReportError
  560. */
  561.  
  562.  
  563. /* -------------------------------------------------------------------------
  564.    Menus
  565.    ------------------------------------------------------------------------- */
  566.  
  567. typedef struct Desk_menu_block *Desk_menu_ptr;
  568. /* See Desk_Wimp_CreateMenu, Desk_Wimp_CreateSubMenu    */
  569.  
  570. typedef union
  571. {
  572.   unsigned int value;
  573.   struct
  574.   {
  575.     unsigned int ticked     : 1;
  576.     unsigned int dotted     : 1;
  577.     unsigned int writable   : 1;
  578.     unsigned int notifysub  : 1;
  579.     unsigned int openshaded : 1;
  580.     unsigned int dummy2     : 2;
  581.     unsigned int last       : 1;
  582.     unsigned int indtitle   : 1;
  583.     unsigned int dummy13    : 13;
  584.     unsigned int shaded     : 1;
  585.     unsigned int dummy1     : 1;
  586.     unsigned int foreground : 4;
  587.     unsigned int background : 4;
  588.   } data;
  589. } Desk_menu_flags;
  590. /*
  591. Used in Desk_menu_item
  592. */
  593.  
  594. typedef union
  595. {
  596.   Desk_menu_ptr      menu;
  597.   Desk_window_handle window;
  598.   int           value;
  599. } Desk_menu_submenu;
  600.  
  601.  
  602. typedef struct
  603. {
  604.   Desk_menu_flags   menuflags;
  605.   Desk_menu_submenu submenu;
  606.   Desk_icon_flags   iconflags;
  607.   Desk_icon_data    icondata;
  608. } Desk_menu_item;
  609. /*
  610. These follow a Desk_menu_block in memory
  611. */
  612.  
  613. typedef struct Desk_menu_block
  614. {
  615.   char     title [Desk_wimp_MAXNAME];
  616.   char     titlefore, titleback, workfore, workback;
  617.   unsigned int width;
  618.   unsigned int height;
  619.   unsigned int gap;
  620.   /*  Followed immediately by menu items */
  621. } Desk_menu_block;
  622. /*
  623. See Desk_menu_ptr, Desk_Wimp_CreateMenu, Desk_Wimp_CreateSubMenu
  624. */
  625.  
  626.  
  627.  
  628. /* -------------------------------------------------------------------------
  629.    Caret/Keypress data:
  630.    ------------------------------------------------------------------------- */
  631.  
  632. typedef int Desk_key_press;
  633.  
  634. typedef struct
  635. {
  636.   Desk_window_handle window;
  637.   Desk_icon_handle   icon;
  638.   Desk_wimp_point    offset;
  639.   int           height;
  640.   int           index;
  641. } Desk_caret_block;
  642. /*
  643. This is a field in the Desk_event_data union
  644. */
  645.  
  646.  
  647. typedef struct
  648. {
  649.   Desk_caret_block caret;
  650.   Desk_key_press   code;
  651. } Desk_key_block;
  652. /*
  653. This is a field in the Desk_event_data union
  654. */
  655.  
  656. typedef struct
  657. {
  658.   int address;
  659.   int contents;
  660. } Desk_pollword_block;
  661. /*
  662. This is a field in the Desk_event_data union
  663. */
  664.  
  665.  
  666. /* -------------------------------------------------------------------------
  667.    Wimp message data:
  668.    ------------------------------------------------------------------------- */
  669.  
  670. typedef enum
  671. {
  672.   Desk_message_QUIT           = 0,
  673.   Desk_message_CLOSEDOWN      = 0,
  674.   Desk_message_DATASAVE       = 1,
  675.   Desk_message_DATASAVEACK    = 2,
  676.   Desk_message_DATASAVEOK     = 2,
  677.   Desk_message_DATALOAD       = 3,
  678.   Desk_message_DATALOADACK    = 4,
  679.   Desk_message_DATALOADOK     = 4,
  680.   Desk_message_DATAOPEN,
  681.   Desk_message_RAMFETCH,
  682.   Desk_message_RAMTRANSMIT,
  683.   Desk_message_PREQUIT,
  684.   Desk_message_PALETTECHANGE,
  685.   Desk_message_SAVEDESK,
  686.   Desk_message_DEVICECLAIM,
  687.   Desk_message_DEVICEINUSE,
  688.   Desk_message_DATASAVED,
  689.   
  690.     Desk_message_CLAIMENTITY    = 15,
  691.     Desk_message_DATAREQUEST    = 16,
  692.     Desk_message_RELEASEENTITY    = 19,
  693.  
  694.   Desk_message_FILEROPENDIR   = 0x400,
  695.   Desk_message_FILERCLOSEDIR,
  696.   Desk_message_FILEROPENDIRAT,
  697.   Desk_message_FILERSELECTIONDIRECTORY,
  698.   Desk_message_FILERADDSELECTION,
  699.   Desk_message_FILERACTION,
  700.   Desk_message_FILERCONTROLACTION,
  701.   Desk_message_FILERSELECTION,
  702.   
  703.   Desk_message_HELPREQUEST    = 0x502,
  704.   Desk_message_HELPREPLY,
  705.  
  706.   Desk_message_NOTIFY         = 0x40040,
  707.   Desk_message_MENUWARNING    = 0x400C0,
  708.   Desk_message_MENUWARN       = 0x400C0,
  709.   Desk_message_MODECHANGE,
  710.   Desk_message_TASKINITIALISE = 0x400C2,
  711.   Desk_message_INITTASK       = 0x400C2,
  712.   Desk_message_TASKCLOSEDOWN  = 0x400C3,
  713.   Desk_message_CLOSETASK      = 0x400C3,
  714.   Desk_message_SLOTSIZE       = 0x400C4,
  715.   Desk_message_SLOTCHANGE     = 0x400C4,
  716.   Desk_message_SETSLOT        = 0x400C5,
  717.   Desk_message_TASKNAMERQ,
  718.   Desk_message_TASKNAMEIS,
  719.   Desk_message_TASKSTARTED,
  720.   Desk_message_MENUSDELETED,              /* RO3 Menu closed warning    */
  721.   Desk_message_WINDOWINFO     = 0x400CC,  /* RO3 For window iconisation */
  722.  
  723.   Desk_message_POPUPRQ        = 0x46D40,  /* PopUp messages - cf PopUp.h */
  724.   Desk_message_POPUPREQUEST   = 0x46D40,
  725.   Desk_message_POPUPSTATE,
  726.   Desk_message_POPUPCLOSED,
  727.  
  728.   Desk_message_PRINTFILE      = 0x80140,
  729.   Desk_message_WILLPRINT,
  730.   Desk_message_PRINTSAVE,
  731.   Desk_message_PRINTINIT,
  732.   Desk_message_PRINTERROR,
  733.   Desk_message_PRINTTYPEODD,
  734.   Desk_message_PRINTTYPEKNOWN,
  735.   Desk_message_SETPRINTER,
  736.   
  737.   Desk_message_PSPRINTERQUERY = 0x8014c,
  738.   Desk_message_PSPRINTERACK,
  739.   Desk_message_PSPRINTERMODIFIED,
  740.   Desk_message_PSPRINTERDEFAULTS,
  741.   Desk_message_PSPRINTERDEFAULTED,
  742.   Desk_message_PSPRINTERNOTPS,
  743.   Desk_message_RESETPRINTER,
  744.   Desk_message_PSISFONTPRINTRUNNING,
  745.   
  746.   Desk_message_TASKWINDOW_INPUT = 0x808c0,
  747.   Desk_message_TASKWINDOW_OUTPUT,
  748.   Desk_message_TASKWINDOW_EGO,
  749.   Desk_message_TASKWINDOW_MORIO,
  750.   Desk_message_TASKWINDOW_MORITE,
  751.   Desk_message_TASKWINDOW_NEWTASK,
  752.   Desk_message_TASKWINDOW_SUSPEND,
  753.   Desk_message_TASKWINDOW_RESUME
  754.   
  755.   
  756.   
  757. } Desk_message_action;
  758. /*
  759. Part of Desk_message_header
  760. */
  761.  
  762.  
  763.  
  764. typedef int Desk_message_destinee;  /* Window or Task handle */
  765.  
  766.  
  767. typedef struct
  768. {
  769.   unsigned int   size;
  770.   Desk_task_handle    sender;
  771.   unsigned int   myref;
  772.   unsigned int   yourref;
  773.   Desk_message_action action;
  774. } Desk_message_header;
  775. /*
  776. Used in Desk_message_block
  777. */
  778.  
  779. typedef struct
  780. {
  781.   Desk_window_handle window;
  782.   Desk_icon_handle   icon;
  783.   Desk_wimp_point    pos;
  784.   int           estsize;
  785.   int           filetype;
  786.   char          leafname[12];
  787. } Desk_message_datasave;
  788. /*
  789. Part of the Desk_message_block union
  790. */
  791.  
  792. typedef struct
  793. {
  794.   Desk_window_handle window;   /* window, icon, pos, estsize, filetype all copied */
  795.   Desk_icon_handle   icon;     /* from the initiating datasave message            */
  796.   Desk_wimp_point    pos;
  797.   int           estsize;
  798.   int           filetype;
  799.   char          filename[212];
  800. } Desk_message_datasaveack;
  801. /*
  802. Part of the Desk_message_block union
  803. */
  804.  
  805.  
  806. typedef struct
  807. {
  808.   Desk_window_handle window;
  809.   Desk_icon_handle   icon;
  810.   Desk_wimp_point    pos;
  811.   int           size;
  812.   int           filetype;
  813.   char          filename[212];
  814. } Desk_message_dataload;
  815. /*
  816. Part of the Desk_message_block union
  817. */
  818.  
  819.  
  820. typedef struct         /* DataLoadAck is identical to DataLoad */
  821. {
  822.   Desk_window_handle window;
  823.   Desk_icon_handle   icon;
  824.   Desk_wimp_point    pos;
  825.   int           size;
  826.   int           filetype;
  827.   char          filename[212];
  828. } Desk_message_dataloadack;
  829. /*
  830. Part of the Desk_message_block union
  831. */
  832.  
  833.  
  834. typedef Desk_message_dataload Desk_message_dataopen;
  835. /*
  836. Part of the Desk_message_block union
  837. */
  838.  
  839.  
  840. typedef struct
  841. {
  842.   char *buffer;
  843.   int  buffsize;
  844. } Desk_message_ramfetch;
  845. /*
  846. Part of the Desk_message_block union
  847. */
  848.  
  849.  
  850. typedef struct
  851. {
  852.   char *buffer;   /* copied directly from initiating RamFetch */
  853.   int  byteswritten;
  854. } Desk_message_ramtransmit;
  855. /*
  856. Part of the Desk_message_block union
  857. */
  858.  
  859.  
  860.  
  861. typedef union    {
  862.     unsigned int    value;
  863.     struct    {
  864.         unsigned int    caretorselectionclaim    : 2;
  865.         unsigned int    clipboardclaim        : 1;
  866.         }
  867.         data;
  868.     }
  869.     Desk_message_claimentity;
  870. /*
  871. Broadcast by app when it claims the clipboard (eg the user chooses 'Copy' from the app's menu).
  872. If a receiver previously owned the clipboard, it should deallocate its clipboard.
  873.  
  874. Part of the Desk_message_block union.
  875.  */
  876.  
  877.  
  878.  
  879. typedef union    {
  880.     unsigned int    value;
  881.     struct    {
  882.         unsigned int    caretorselectionrelease    : 2;
  883.         unsigned int    clipboardrelease    : 1;
  884.         }
  885.         data;
  886.     }
  887.     Desk_message_releaseentity;
  888. /*
  889. Broadcast by app when it is about to quit and currently owns the clipboard.
  890.  
  891. Part of the Desk_message_block union
  892.  */
  893.  
  894.  
  895. typedef struct    {
  896.     Desk_window_handle    window;
  897.     void*            reference;
  898.     Desk_wimp_point        pos;
  899.     union    {
  900.         int    value;
  901.         struct    {
  902.             unsigned int    unused_0_1    : 2;
  903.             unsigned int    clipboard    : 1;
  904.             }
  905.             data;
  906.         }
  907.         flags;
  908.     int    filetypes[ 54];    /* list of known filetypes in order of preference, terminated with -1    */
  909.     }
  910.     Desk_message_datarequest;
  911. /*
  912. Broadcast by app when it wants to import the clipboard (eg 'paste'
  913. chosen from the app's menu, but the app doesn't own the clipboard.
  914.  
  915. Part of the Desk_message_block union
  916.  */
  917.  
  918.  
  919. typedef struct
  920. {
  921.   Desk_mouse_block where;  /* Where is help needed for? */
  922. } Desk_message_helprequest;
  923. /*
  924. Part of the Desk_message_block union
  925. */
  926.  
  927.  
  928. typedef struct
  929. {
  930.   char text[200];
  931. } Desk_message_helpreply;
  932. /*
  933. Part of the Desk_message_block union
  934. */
  935.  
  936.  
  937. typedef struct
  938. {
  939.   int filler[5];
  940.   int filetype;
  941.   char filename[212];
  942. } Desk_message_print;
  943. /*
  944. Part of the Desk_message_block union
  945. */
  946.  
  947. typedef struct
  948. {
  949.   int        id;                      /* The number given to Desk_Wimp_CreateMenu */
  950.   Desk_wimp_point openpos;                 /* Position to open window/menu at     */
  951.   int        selection[10];           /* -1 terminated list of menu hits     */
  952. } Desk_message_menuwarn;
  953. /*
  954. Part of the Desk_message_block union
  955. */
  956.  
  957. typedef struct
  958. {
  959.   Desk_window_handle window;
  960.   Desk_task_handle   task;
  961.   char          title[20];
  962. } Desk_message_iconize;
  963. /*
  964. Part of the Desk_message_block union
  965. */
  966.  
  967.  
  968. typedef struct
  969. {
  970.   Desk_window_handle window;
  971.   int           dummy;
  972.   char          spritename[8];
  973.   char          title[20];
  974. } Desk_message_windowinfo;
  975. /*
  976. Part of the Desk_message_block union
  977. */
  978.  
  979.  
  980. typedef struct
  981. {
  982.   Desk_message_header  header;
  983.   union
  984.   {
  985.     char                 bytes [236];
  986.     int                  words [59];
  987.     Desk_message_datasave     datasave;
  988.     Desk_message_datasaveack  datasaveack;
  989.     Desk_message_dataload     dataload;
  990.     Desk_message_dataopen     dataopen;
  991.     Desk_message_ramfetch     ramfetch;
  992.     Desk_message_ramtransmit  ramtransmit;
  993.     
  994.     Desk_message_claimentity    claimentity;
  995.     Desk_message_releaseentity    releaseentity;
  996.     Desk_message_datarequest    datarequest;
  997.     
  998.     Desk_message_helprequest  helprequest;
  999.     Desk_message_helpreply    helpreply;
  1000.     Desk_message_print        print;
  1001.     Desk_message_menuwarn     menuwarn;
  1002.     Desk_message_iconize      iconize;
  1003.     Desk_message_windowinfo   windowinfo;
  1004.  
  1005. #if 0
  1006.     Desk_message_popuprequest popuprequest;    /* If PopUps in use, also include */
  1007.     Desk_message_popupstate   popupstate;      /* the relevant PopUp messages    */
  1008. #endif
  1009.  
  1010.   } data;
  1011. } Desk_message_block;
  1012. /*
  1013. Part of the Desk_event_data union
  1014. */
  1015.  
  1016. /* -------------------------------------------------------------------------
  1017.    Wimp events:
  1018.    ------------------------------------------------------------------------- */
  1019.  
  1020. #define Desk_wimp_NUMBEROFEVENTS 20
  1021. /*
  1022.  *  N.B.  There aren't 20, but you need an array this big to store them
  1023.  *  due to the way they are numbered.
  1024.  */
  1025.  
  1026.  
  1027. typedef enum
  1028. {
  1029.   Desk_event_ANY                 = -99,  /*  see event.c: this is used to denote
  1030.                                      *  any event type, any window handle,
  1031.                                      *  or any icon handle ... thus -99.
  1032.                                      */
  1033.   Desk_event_NULL                = 0,
  1034.   Desk_event_REDRAW,
  1035.   Desk_event_OPEN,
  1036.   Desk_event_CLOSE,
  1037.   Desk_event_PTRLEAVE,
  1038.   Desk_event_PTRENTER,
  1039.   Desk_event_CLICK = 6,
  1040.   Desk_event_BUTTON = 6,
  1041.   Desk_event_USERDRAG,
  1042.   Desk_event_KEY,
  1043.   Desk_event_MENU,
  1044.   Desk_event_SCROLL,
  1045.   Desk_event_LOSECARET,
  1046.   Desk_event_GAINCARET,
  1047.   Desk_event_NONZEROPOLLWORD,
  1048.   Desk_event_USERMESSAGE         = 17,
  1049.   Desk_event_SEND                = 17,
  1050.   Desk_event_USERMESSAGERECORDED = 18,
  1051.   Desk_event_SENDWANTACK         = 18,
  1052.   Desk_event_USERMESSAGEACK      = 19,
  1053.   Desk_event_ACK                 = 19
  1054. } Desk_event_type;
  1055. /*
  1056. Used in Desk_event_pollblock
  1057. */
  1058.  
  1059. typedef union
  1060. {
  1061.   unsigned int value;
  1062.   struct
  1063.   {
  1064.     unsigned int null                : 1;
  1065.     unsigned int redraw              : 1;
  1066.     unsigned int open                : 1;
  1067.     unsigned int close               : 1;
  1068.     unsigned int ptrleave            : 1;
  1069.     unsigned int ptrenter            : 1;
  1070.     unsigned int click               : 1;
  1071.     unsigned int userdrag            : 1;
  1072.     unsigned int key                 : 1;
  1073.     unsigned int menu                : 1;
  1074.     unsigned int scroll              : 1;
  1075.     unsigned int losecaret           : 1;
  1076.     unsigned int gaincaret           : 1;
  1077.     unsigned int nonzeropollword     : 1;
  1078.     unsigned int dummy14             : 1;
  1079.     unsigned int dummy15             : 1;
  1080.     unsigned int dummy16             : 1;
  1081.     unsigned int usermessage         : 1;
  1082.     unsigned int usermessagerecorded : 1;
  1083.     unsigned int usermessageack      : 1;
  1084.     unsigned int dummy20             : 1;
  1085.     unsigned int dummy21             : 1;
  1086.     unsigned int r3ispollwordptr     : 1;
  1087.     unsigned int highprioritypoll    : 1;
  1088.     unsigned int keepfpregisters     : 1;
  1089.   } data;
  1090. } Desk_event_pollmask;
  1091. /*
  1092. Used by Desk_Wimp_Poll
  1093. */
  1094.  
  1095. typedef struct
  1096. {
  1097.   Desk_window_openblock openblock;
  1098.   Desk_wimp_point       direction;
  1099. } Desk_scroll_rq;
  1100. /*
  1101. Part of the Desk_message_block union
  1102. */
  1103.  
  1104.  
  1105. typedef union
  1106. {
  1107.   Desk_caret_block      caret;
  1108.   Desk_key_block        key;
  1109.   Desk_pollword_block   pollword;
  1110.   Desk_window_openblock openblock;
  1111.   Desk_message_block    message;
  1112.   Desk_mouse_block      mouse;
  1113.   Desk_wimp_box         screenrect;
  1114.   int              selection[10];
  1115.   Desk_scroll_rq        scroll;
  1116.   char             bytes [256];
  1117.   int              words [64];
  1118. } Desk_event_data;
  1119. /*
  1120. Part of Desk_event_pollblock
  1121. */
  1122.  
  1123. typedef struct
  1124. {
  1125.   Desk_event_type type;
  1126.   Desk_event_data data;
  1127. } Desk_event_pollblock;
  1128. /*
  1129. Used by Desk_Wimp_Poll
  1130. */
  1131.  
  1132. /* -------------------------------------------------------------------------
  1133.    Miscellanea
  1134.    ------------------------------------------------------------------------- */
  1135.  
  1136.  
  1137. /* See Font.h for a description of this */
  1138. typedef struct
  1139. {
  1140.   char fonts[256];
  1141. } Desk_font_array;
  1142.  
  1143.  
  1144. typedef struct
  1145. {
  1146.   Desk_window_block   *buffer;
  1147.   char           *workfree;
  1148.   char           *workend;
  1149.   Desk_font_array     *font;
  1150.   char           *name;
  1151.   unsigned int   index;
  1152. } Desk_template_block;
  1153.  
  1154.  
  1155. typedef struct
  1156. {
  1157.   Desk_wimp_point mul;
  1158.   Desk_wimp_point div;
  1159. } Desk_scale_block;
  1160.  
  1161. #ifdef __cplusplus
  1162. }
  1163. #endif
  1164.  
  1165.  
  1166. #endif
  1167.